﻿/************************************************************************************
 * xujiajun@yoozoo.com 御剑
 * 显示功能相关的命令
 ***********************************************************************************/

namespace WorldMapBase.Display
{
    /// <summary>
    /// 显示功能相关的命令
    /// </summary>
    public abstract class DisplayCommand
    {
        /// <summary>
        /// 命令ID
        /// </summary>
        internal int commandID;

        /// <summary>
        /// 显示元素
        /// </summary>
        internal protected IDisplayElement element;

        /// <summary>
        /// 元素工厂
        /// </summary>
        /// <param name="factory">元素工厂</param>
        public void Execute(DisplayElementFactory factory)
        {
            OnExecute(factory);
        }

        /// <summary>
        /// 返回该指令涉及的资源ID
        /// </summary>
        /// <returns>资源ID</returns>
        internal protected abstract int GetResID();

        /// <summary>
        /// 当指令执行时响应
        /// </summary>
        /// <param name="factory">元素工厂</param>
        protected abstract void OnExecute(DisplayElementFactory factory);
    }

}
